import java.util.*;
import java.io.*;
public class 返回无序数组中累加和为给定值的子数组个数 {
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    public static int MAXN = 100001;
    public static int[] arr = new int[MAXN];
    public static Map<Integer,Integer> map = new HashMap<>();
    public  static int n,k;
    public static void main(String[] args) throws IOException {
        n = in.nextInt();
        k = in.nextInt();
        for (int i = 0;i < n;i++) {
            arr[i] = in.nextInt();
        }
        out.println(compute());
        out.close();

    }


    public static int compute() {
        int ans = 0;
        map.put(0,-1);
        for (int i = 0,sum = 0;i < n;i++) {
            sum += arr[i];
            if (map.containsKey(sum - k)) {
                ans = Math.max(ans,i - map.get(sum - k));
            }
            if (!map.containsKey(sum)) {
                map.put(sum,i);
            }
        }
        return ans;
    }
    public static class Read {
        StringTokenizer st = new StringTokenizer("");
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String next() throws IOException {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(bf.readLine());
            }
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
    }
}
